<?php
define('IN_QY',true);
session_start();
require("include/common.inc.php");
require('include/functions.php');
define('SCRIPT','ad_list');
if(!$_COOKIE['userid']){
    echo "<script type='text/javascript'>location.href='mlogin.php';</script>";
    exit;
}


$sqlsm = "select * from tbl_shiming where userid=".$_COOKIE['userid'];
$querysm=mysql_query($sqlsm);
$rowsm=mysql_fetch_array($querysm);

if($_GET['act']=='add'){
    // 判断是否已经存在
    $sql = "select identify_pic from tbl_qinguan WHERE user_id = ".$_COOKIE['userid']." limit 1";
    $info = mysql_fetch_array(mysql_query($sql));
    $user_id = $_COOKIE['userid'];
    $ywyuedu=$_POST['ywyuedu'].",".$_POST['ywyueduu'];

    $ywyuedu1=rtrim($ywyuedu,",");
    if($info)
    {
        $sql = "update tbl_qinguan set identify_pic = '".$ywyuedu1."' where user_id ='".$user_id."' ";
    }else{
        $sql = "insert into tbl_qinguan(identify_pic,user_id) VALUES ('$ywyuedu1',$user_id)";
    }
    mysql_query($sql);

    echo "<script type='text/javascript'>alert('\u63d0\u4ea4\u6210\u529f');location.href='taodzf.php';</script>";
}

?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title><?=$_COOKIE['shuyu']?>清关资料-众晒网</title>
    <link href="/ui/css/Hui.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #header{width:100%; position:absolute; top:0;}
        #footer{width:100%; height:55px; position:absolute; bottom:0;}
        #main{width:100%; overflow: auto; position:absolute; top:45px;bottom:0px;}
    </style>
    <script src="/ui/js/jquery.min.js"></script>
</head>
<body>
<header class="H-header H-theme-background-color-white" id="header">
    <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-10 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-theme-font-color-black H-font-size-18 H-vertical-middle"></i></span>
    <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-black H-position-absolute H-width-100-percent H-font-weight-500">上传清关图片</div>
</header>

<form action="?act=add" id="signupok"  method="post"  class="registerform"  name="addform" enctype="multipart/form-data"  onSubmit="return beforeSubmit(this);">
    <div id="main">
        <div class="H-padding-vertical-bottom-10"></div>
        <div class="H-border-vertical-both-after">

            <div style="width:50px;height:80px" onclick="getElementById('inputfile').click()">
                <div style="float:left;border: 1px dashed #ccc;width:60px;height:73px;margin-left:116px;" >
                    <img class="am-circle" src="/ui/image/plus1.png"  style="width:50px;height:50px" alt="" title="添加照片">
                    <input type="file" accept="image/*" multiple="multiple" id="inputfile" style="height:0;width:0;z-index: -1; position: absolute;left: 10px;top: -100px;"/>
                    <span style="font-size:12px">添加照片</span>
                </div>
            </div>

            <div id="feedback"  value="feedback" name="ywyuedu" style="margin-bottom:10px">
                <input style=" display:none" id="srcall" name="ywyuedu">
            </div>


            <div class="H-padding-vertical-bottom-10"></div>
            <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
                <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
                <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-15 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">请上传清晰的本人身份证正面照</div>
            </div>

        </div>
		
		<!---------剑阁县--------------------->
		
	        <div class="H-padding-vertical-bottom-10"></div>
        <div class="H-border-vertical-both-after">

            <div style="width:50px;height:80px" onclick="getElementById('inputfilee').click()">
                <div style="float:left;border: 1px dashed #ccc;width:60px;height:73px;margin-left:116px;" >
                    <img class="am-circle" src="/ui/image/plus1.png"  style="width:50px;height:50px" alt="" title="添加照片">
                    <input type="file" accept="image/*" multiple="multiple" id="inputfilee" style="height:0;width:0;z-index: -1; position: absolute;left: 10px;top: -100px;"/>
                    <span style="font-size:12px">添加照片</span>
                </div>
            </div>

            <div id="feedbackk"  value="feedbackk" name="ywyueduu" style="margin-bottom:10px">
                <input style=" display:none" name="ywyueduu">
            </div>
                <input style=" display:none" id="fanmian" value="0">

            <div class="H-padding-vertical-bottom-10"></div>
            <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
                <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
                <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-15 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">请上传清晰的本人身份证反面照</div>
            </div>

        </div>	
		
		
            <div style="margin-top:20px">
                <center>
                    <button  type="submit" name="signup" onclick="clicimg()" class="H-button H-width-100-percent  H-font-size-15 H-outline-none H-theme-background-color-transparent H-padding-vertical-both-8 H-padding-horizontal-both-20 H-theme-font-color8 H-theme-border-color8 H-theme-border-color8-click H-theme-background-color8-click H-theme-font-color8-click H-border-radius-3"  style="width:80%">确定提交</button>
                </center>
            </div>




    </div>

</form>

<!--################################底部开始################################-->
<?include('footer.php');?>
<!--################################底部结束################################-->
<script src="/ui/script/H.js" type="text/javascript"></script>
<script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //响应文件添加成功事件
        $("#inputfile").change(function(){
            //创建FormData对象
            var data = new FormData();
            //为FormData对象添加数据
            $.each($('#inputfile')[0].files, function(i, file) {
                data.append('upload_file'+i, file);
            });
            $(".loading").show();
            //显示加载图片
            layer.open({
                type: 2
                ,content: '上传中.....'
            });
            //发送数据
            $.ajax({
                url:'submit_form_process.php',
                type:'POST',
                data:data,
                cache: false,
                contentType: false,     //不可缺参数
                processData: false,     //不可缺参数
                success:function(data){
                    console.log(data);
                    data = $(data).html();
                    //alert(data);
                    //第一个feedback数据直接append，其他的用before第1个（ .eq(0).before() ）放至最前面。
                    //data.replace(/&lt;/g,'<').replace(/&gt;/g,'>') 转换html标签，否则图片无法显示。

                    // 只能传一张照片 cj
                    if($("#feedback").children('img').length == 0)
                    {
                        $("#feedback").append(data.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));
                    }else{
                        $("#feedback").children('img').eq(0).remove();
                        $("#feedback").append(data.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));
                    }
//                    else $("#feedback").children('img').eq(0).before(data.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));
                    $(".loading").hide();   //加载成功移除加载图片
                    layer.closeAll();
                },
                error:function(){
                    alert('上传出错');
                    $(".loading").hide();   //加载失败移除加载图片

                }
            });
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function(){
        //响应文件添加成功事件
        $("#inputfilee").change(function(){
            //创建FormData对象
            var data = new FormData();
            //为FormData对象添加数据
            $.each($('#inputfilee')[0].files, function(i, file) {
                data.append('upload_file'+i, file);
            });
            $(".loading").show();
            //显示加载图片
            layer.open({
                type: 2
                ,content: '上传中.....'
            });
            //发送数据
            $.ajax({
                url:'submit_form_process.php',
                type:'POST',
                data:data,
                cache: false,
                contentType: false,     //不可缺参数
                processData: false,     //不可缺参数
                success:function(data){
                    console.log(data);
                    data = $(data).html();
                    //alert(data);
                    //第一个feedback数据直接append，其他的用before第1个（ .eq(0).before() ）放至最前面。
                    //data.replace(/&lt;/g,'<').replace(/&gt;/g,'>') 转换html标签，否则图片无法显示。

                    // 只能传一张照片 cj
                    if($("#feedbackk").children('img').length == 0)
                    {
                        $("#feedbackk").append(data.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));
                    }else{
                        $("#feedbackk").children('img').eq(0).remove();
                        $("#feedbackk").append(data.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));
                    }
//                    else $("#feedback").children('img').eq(0).before(data.replace(/&lt;/g,'<').replace(/&gt;/g,'>'));
                    $(".loading").hide(); 


                     $("#fanmian").val("1"); 


					//加载成功移除加载图片
                    layer.closeAll();
                },
                error:function(){
                    alert('上传出错');
                    $(".loading").hide();   //加载失败移除加载图片

                }
            });
        });
    });
</script>




<script type="text/javascript">
    function clicimg(){
        var legth=document.getElementsByName('thissrc');
        var srca="";
        for(var i=0;i<legth.length;i++){
            srca+=legth[i].src;
            srca+=",";
        }
        document.getElementById('srcall').value=srca;
    }
</script>
<!-- 手机号，身份证号,邮箱验证开始 -->
<script type="text/javascript">
    function beforeSubmit(form){
		var fanmian= $("#fanmian").val(); 
		console.log(fanmian);
        if (document.addform.ywyuedu.value==""){


            layer.open({
                content: '请上传身份证正面照'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });

            return false;
        }
		
        if (fanmian!=1){


            layer.open({
                content: '请上传身份证反面照'
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });

            return false;
        }

		
        document.addform.submit();
        return true;
    }

</script>
<!-- 手机号，身份证号邮箱验证结束 -->

</body>
</html>